/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tree;

/**
 *
 * @author adam
 */
public class FileOpenWorkerTree extends VlastniProgramTree {

    private String fileName;
    private boolean read;

    public FileOpenWorkerTree(Position start, Position end, String fileName) {
        super(start, end);
        this.fileName = fileName;

    }

    public FileOpenWorkerTree(Position start, Position end, String fileName, boolean read) {
        super(start, end);
        this.fileName = fileName;
        this.read = read;
    }

    @Override
    public void accept(TreeVisitor visitor) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void generate(Context ctx) {
        if (read) {
            ctx.print("ofr");
        } else {
            ctx.print("ofw");
        }
        ctx.print(" ");
        ctx.println(fileName);

    }

    /**
     * @return the read
     */
    public boolean isRead() {
        return read;
    }

    /**
     * @param read the read to set
     */
    public void setRead(boolean read) {
        this.read = read;
    }
}
